home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / ViewCell / CellCursorCollector.cp < prev    next >
Text File  |  2000-06-23  |  898b  |  40 lines

  1. // CellCursorCollector.cp
  2.  
  3. #ifndef CellCursorCollector_h
  4. #include "CellCursorCollector.h"
  5. #endif
  6. #ifndef ViewCell_h
  7. #include "ViewCell.h"
  8. #endif
  9. #ifndef MouseEvent_h
  10. #include "MouseEvent.h"
  11. #endif
  12. #ifndef Canvas_h
  13. #include "Canvas.h"
  14. #endif
  15.  
  16. CellCursorCollector::CellCursorCollector( const MouseEvent& theEvent,
  17.                                                         RegionObject& theRegion )
  18.   : CellVisitor( Rectangle( theEvent.LocalPoint().h,
  19.                                        theEvent.LocalPoint().v,
  20.                                        theEvent.LocalPoint().h + 1,
  21.                                        theEvent.LocalPoint().v + 1 ) ),
  22.      event( theEvent ),
  23.      region( theRegion ),
  24.      cursor( 0 )
  25.   {
  26.   }
  27.  
  28. void CellCursorCollector::Visit( ViewCell& cell,
  29.                                             const Canvas& canvas )
  30.   {
  31.     Assert( cursor == 0 );
  32.     Assert( canvas.Visible() );
  33.     Assert( canvas.Clip().Contains( event.LocalPoint() ) );
  34.     
  35.     region = canvas.Clip();
  36.     cursor = &cell.Cursor( canvas, event, region );
  37.     
  38.     Assert( cursor != 0 );
  39.   }
  40.